home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Mac OS USB DDK / Examples / USBSampleStorageDriver / About USB SampleStorage next >
Encoding:
Text File  |  1999-01-12  |  3.9 KB  |  53 lines  |  [TEXT/MPS ]

  1. The USB Storage Driver sample contains three parts: the Shim, the native UnitTable driver and the Storage Class Driver.
  2. When the driver is built, there will be two extensions: the Shim and the Class Driver. ( For easy identification and to
  3. avoid user confusion, the name of the drive that the drivers are built for should be used in the names of these extensions)
  4.  
  5. About the Shim:
  6. The Shim extension actually contains both the Shim and the UnitTable driver. The Shim is loaded by the USB Family Expert
  7. during startup and registers to be notified when its device is attached or removed.  
  8.  
  9. When the shim is notified that a device has been attached, it loads the UnitTable driver into memory, installs it into the
  10. UnitTable and opens the driver.
  11.  
  12. Once the UnitTable driver is loaded, the Shim makes a control call to the UnitTable driver to inform it of the address of
  13. the dispatach table for its Class Driver.
  14.  
  15. When the Shim is notified that the device is removed, it will check to see if there are a mounted volume belonging to
  16. the UnitTable Driver.  If there is, the Shim will try to unmount it.  If the volume can not be unmounted, (open files, or
  17. disk cache information that needs to be flushed) the Shim will offline (ghost) the volume.  When a volume is offlined,
  18. the system will post a dialog saying to reinsert the disk if it needs access to information on the device.  When this dialog
  19. is displayed, the device can be reattached and the system will online the volume and remove the dialog.
  20.  
  21. About the UnitTable Driver:
  22. The UnitTable driver handles all operating system and device specific actions.  The UnitTable driver is fully native or a
  23. 'ndrv' and follows the structure for native drivers as described in the "Designing PCI Cards and Drivers for Power Macintosh
  24. Computers".  Since it is a native driver, the UnitTable uses the utilites provided by the Driver Services Library (DSL).
  25. Several differences of the UnitTable driver over the old model or 'DRVR' drivers are:
  26. 1) native drivers do not directly access their DCEs and must use the services provided by the DSL to set DCE fields
  27. 2) native drivers do not get accRun calls, therefore they must use interrupt timers provided by the DSL to get time
  28. 3) the UnitTable driver does not use VBL task, again, it uses the interrupt timer functions provided by the DSL
  29. 4) native drivers can fully access any internal global variables without needing to set up or switch A5Worlds
  30. 5) the DeviceManager directs all driver access calls through the DoDriverIO function, therefore no 68000 assembly code
  31. is needed to set up the offsets to the Open,Prime,Status,Control and Close routines
  32.  
  33. The UnitTable driver is bus independent and does not know about USB structures and protocols.  All commands are passed
  34. to the Class Driver to be sent to the USB subsystem.
  35.  
  36. About the Class Driver:
  37. The class drivers only job is to handle the transaction between the UnitTable driver and the USB subsystem.  The class
  38. driver does not know anything about the device or device commands.  The class driver just takes the command passed to
  39. it by the UnitTable driver and embeds it into a USB Device Request to send to the device.
  40.  
  41. The class driver has a dispatch table that the UnitTable driver uses to communicate with the class driver.  The dispatch
  42. table and parameter blocks are defined in the Storage Class' API header file.
  43.  
  44. The class driver is automatically loaded by the USB subsystem when a device that matches the device information in the
  45. TheUSBDriverDescription that the class driver exports, and automatically removed when the device it was loaded for is
  46. removed.
  47.  
  48. About Device Information:
  49. All USB device information used to identifed which device the Shim needs to be notified for and the class driver needs
  50. to be loaded for are contained in the SampleStorageDeviceID.h header file.  This file contains constants that are used
  51. any time the Shim or Class driver needs the exact device information.  This file contains the VendorID, ProductID, ClassID
  52. and SubClassID.
  53.